\(\int \frac {\tan ^3(e+f x)}{a+b \sec ^2(e+f x)} \, dx\) [338]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 45 \[ \int \frac {\tan ^3(e+f x)}{a+b \sec ^2(e+f x)} \, dx=-\frac {\log (\cos (e+f x))}{b f}+\frac {(a+b) \log \left (b+a \cos ^2(e+f x)\right )}{2 a b f} \]

[Out]

-ln(cos(f*x+e))/b/f+1/2*(a+b)*ln(b+a*cos(f*x+e)^2)/a/b/f

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 45, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {4223, 457, 78} \[ \int \frac {\tan ^3(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {(a+b) \log \left (a \cos ^2(e+f x)+b\right )}{2 a b f}-\frac {\log (\cos (e+f x))}{b f} \]

[In]

Int[Tan[e + f*x]^3/(a + b*Sec[e + f*x]^2),x]

[Out]

-(Log[Cos[e + f*x]]/(b*f)) + ((a + b)*Log[b + a*Cos[e + f*x]^2])/(2*a*b*f)

Rule 78

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 457

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 4223

Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*tan[(e_.) + (f_.)*(x_)]^(m_.), x_Symbol] :> Module[{ff =
 FreeFactors[Cos[e + f*x], x]}, Dist[-(f*ff^(m + n*p - 1))^(-1), Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*((b + a*
(ff*x)^n)^p/x^(m + n*p)), x], x, Cos[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[(m - 1)/2] &&
IntegerQ[n] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \frac {1-x^2}{x \left (b+a x^2\right )} \, dx,x,\cos (e+f x)\right )}{f} \\ & = -\frac {\text {Subst}\left (\int \frac {1-x}{x (b+a x)} \, dx,x,\cos ^2(e+f x)\right )}{2 f} \\ & = -\frac {\text {Subst}\left (\int \left (\frac {1}{b x}+\frac {-a-b}{b (b+a x)}\right ) \, dx,x,\cos ^2(e+f x)\right )}{2 f} \\ & = -\frac {\log (\cos (e+f x))}{b f}+\frac {(a+b) \log \left (b+a \cos ^2(e+f x)\right )}{2 a b f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.12 (sec) , antiderivative size = 41, normalized size of antiderivative = 0.91 \[ \int \frac {\tan ^3(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {-2 a \log (\cos (e+f x))+(a+b) \log \left (b+a \cos ^2(e+f x)\right )}{2 a b f} \]

[In]

Integrate[Tan[e + f*x]^3/(a + b*Sec[e + f*x]^2),x]

[Out]

(-2*a*Log[Cos[e + f*x]] + (a + b)*Log[b + a*Cos[e + f*x]^2])/(2*a*b*f)

Maple [A] (verified)

Time = 0.80 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.93

method result size
derivativedivides \(\frac {\frac {\left (a +b \right ) \ln \left (b +a \cos \left (f x +e \right )^{2}\right )}{2 b a}-\frac {\ln \left (\cos \left (f x +e \right )\right )}{b}}{f}\) \(42\)
default \(\frac {\frac {\left (a +b \right ) \ln \left (b +a \cos \left (f x +e \right )^{2}\right )}{2 b a}-\frac {\ln \left (\cos \left (f x +e \right )\right )}{b}}{f}\) \(42\)
risch \(-\frac {i x}{a}-\frac {2 i e}{a f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{b f}+\frac {\ln \left ({\mathrm e}^{4 i \left (f x +e \right )}+\frac {2 \left (a +2 b \right ) {\mathrm e}^{2 i \left (f x +e \right )}}{a}+1\right )}{2 b f}+\frac {\ln \left ({\mathrm e}^{4 i \left (f x +e \right )}+\frac {2 \left (a +2 b \right ) {\mathrm e}^{2 i \left (f x +e \right )}}{a}+1\right )}{2 a f}\) \(117\)

[In]

int(tan(f*x+e)^3/(a+b*sec(f*x+e)^2),x,method=_RETURNVERBOSE)

[Out]

1/f*(1/2*(a+b)/b/a*ln(b+a*cos(f*x+e)^2)-1/b*ln(cos(f*x+e)))

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 41, normalized size of antiderivative = 0.91 \[ \int \frac {\tan ^3(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {{\left (a + b\right )} \log \left (a \cos \left (f x + e\right )^{2} + b\right ) - 2 \, a \log \left (-\cos \left (f x + e\right )\right )}{2 \, a b f} \]

[In]

integrate(tan(f*x+e)^3/(a+b*sec(f*x+e)^2),x, algorithm="fricas")

[Out]

1/2*((a + b)*log(a*cos(f*x + e)^2 + b) - 2*a*log(-cos(f*x + e)))/(a*b*f)

Sympy [F]

\[ \int \frac {\tan ^3(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\int \frac {\tan ^{3}{\left (e + f x \right )}}{a + b \sec ^{2}{\left (e + f x \right )}}\, dx \]

[In]

integrate(tan(f*x+e)**3/(a+b*sec(f*x+e)**2),x)

[Out]

Integral(tan(e + f*x)**3/(a + b*sec(e + f*x)**2), x)

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.11 \[ \int \frac {\tan ^3(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {\frac {{\left (a + b\right )} \log \left (a \sin \left (f x + e\right )^{2} - a - b\right )}{a b} - \frac {\log \left (\sin \left (f x + e\right )^{2} - 1\right )}{b}}{2 \, f} \]

[In]

integrate(tan(f*x+e)^3/(a+b*sec(f*x+e)^2),x, algorithm="maxima")

[Out]

1/2*((a + b)*log(a*sin(f*x + e)^2 - a - b)/(a*b) - log(sin(f*x + e)^2 - 1)/b)/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 222 vs. \(2 (43) = 86\).

Time = 0.61 (sec) , antiderivative size = 222, normalized size of antiderivative = 4.93 \[ \int \frac {\tan ^3(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {\frac {{\left (a^{2} + 2 \, a b + b^{2}\right )} \log \left ({\left | -a {\left (\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} + \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1}\right )} - b {\left (\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} + \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1}\right )} - 2 \, a + 2 \, b \right |}\right )}{a^{2} b + a b^{2}} - \frac {\log \left ({\left | -\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} - \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 2 \right |}\right )}{a} - \frac {\log \left ({\left | -\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} - \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} - 2 \right |}\right )}{b}}{2 \, f} \]

[In]

integrate(tan(f*x+e)^3/(a+b*sec(f*x+e)^2),x, algorithm="giac")

[Out]

1/2*((a^2 + 2*a*b + b^2)*log(abs(-a*((cos(f*x + e) + 1)/(cos(f*x + e) - 1) + (cos(f*x + e) - 1)/(cos(f*x + e)
+ 1)) - b*((cos(f*x + e) + 1)/(cos(f*x + e) - 1) + (cos(f*x + e) - 1)/(cos(f*x + e) + 1)) - 2*a + 2*b))/(a^2*b
 + a*b^2) - log(abs(-(cos(f*x + e) + 1)/(cos(f*x + e) - 1) - (cos(f*x + e) - 1)/(cos(f*x + e) + 1) + 2))/a - l
og(abs(-(cos(f*x + e) + 1)/(cos(f*x + e) - 1) - (cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 2))/b)/f

Mupad [B] (verification not implemented)

Time = 20.16 (sec) , antiderivative size = 64, normalized size of antiderivative = 1.42 \[ \int \frac {\tan ^3(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {\ln \left (b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a+b\right )}{2\,a\,f}+\frac {\ln \left (b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a+b\right )}{2\,b\,f}-\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )}{2\,a\,f} \]

[In]

int(tan(e + f*x)^3/(a + b/cos(e + f*x)^2),x)

[Out]

log(a + b + b*tan(e + f*x)^2)/(2*a*f) + log(a + b + b*tan(e + f*x)^2)/(2*b*f) - log(tan(e + f*x)^2 + 1)/(2*a*f
)